// ============================================================================
//
// Copyright (C) 2006-2007 Dengues
//
// Google Group: http://groups.google.com/group/dengues
// QQ Group: 24885404
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
// License as published by the Free Software Foundation; either
// version 2.1 of the License.
//
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//
// ============================================================================
package org.dengues.reports.editor.design.request;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.gef.Request;

/**
 * An Object used to communicate with Views. Request encapsulates the information views need to perform various
 * functions. Requests are used for obtaining selection, and performing generic operations.
 * 
 * /** Qiang.Zhang.Adolf@gmail.com class global comment. Detailled comment <br/>
 * 
 * $Id: Dengues.epf Qiang.Zhang.Adolf@gmail.com 2008-2-22 qiang.zhang $
 * 
 */
public class ReportRequest extends Request {

    /**
     * Selection request <code>SELECTION</code>
     */
    public static final String SELECTION = "selection"; //$NON-NLS-1$

    /**
     * Open editor request. <code>OPEN_EDITOR</code>
     */
    public static final String OPEN_EDITOR = "open editor"; //$NON-NLS-1$

    /**
     * Open editor request. <code>OPEN_EDITOR</code>
     */
    public static final String LOAD_MASTERPAGE = "load masterpage"; //$NON-NLS-1$

    /**
     * Create element request. <code>CREATE_ELEMENT</code>
     */
    public static final String CREATE_ELEMENT = "create element"; //$NON-NLS-1$

    /**
     * Added for fixing bugs 144165 and 151317 Create scalarparameter or resultsetcolumn request.
     */
    public static final String CREATE_SCALARPARAMETER_OR_RESULTSETCOLUMN = "create scalarparameter or resultsetcolumn";

    private Object source;

    private List selectionObject = new ArrayList();

    /**
     * Create a report request.
     */
    public ReportRequest() {
        this(null, SELECTION);
    }

    public ReportRequest(String type) {
        this(null, type);
    }

    /**
     * Create a report request with give source object.
     * 
     * @param source
     */
    public ReportRequest(Object source) {
        this(source, SELECTION);
    }

    public ReportRequest(Object source, String type) {
        super();
        setSource(source);
        setType(type);
    }

    /**
     * Get the source of request.
     * 
     * @return Returns the source.
     */
    public Object getSource() {
        return source;
    }

    /**
     * Set the source of request.
     * 
     * @param source The source to set.
     */
    public void setSource(Object source) {
        this.source = source;
    }

    /**
     * Get the selection objcect of request source.
     * 
     * @return Returns the selectionObject.
     */
    public List getSelectionObject() {
        return selectionObject;
    }

    /**
     * Set the selection object of reqeust source
     * 
     * @param selectionObject The selectionObject to set.
     */
    public void setSelectionObject(List selectionObject) {
        assert selectionObject != null;
        this.selectionObject = selectionObject;
    }

}